package com.dzq.utils
{
import flash.display.DisplayObject;

import mx.controls.listClasses.ListBase;
	
	/**
	 * @author Ethan.Du
	 * @date 2008-05-19
	 */
public class UIUtil
{
	
	/**
	 * Vertical Scroll Object
	 */
	public static function verticalScrollObject(obj:Object, speed:int):void{
            	
    	//var target:ListBase = obj as ListBase;
    	var target:Object = obj;
    	
    	var pos:Number = target.verticalScrollPosition + speed;
    	 if( pos <= 0 ){
    		target.verticalScrollPosition = 0;
    	}else if( pos >= target.maxVerticalScrollPosition){
    		target.verticalScrollPosition = target.maxVerticalScrollPosition;
    	}else{
    		target.verticalScrollPosition = pos;
    	} 
    	
		target.validateNow();
    	 
    }
    
    
    /**
	 * Hor Scroll Object
	 */
	public static function horizontalScrollObject(obj:Object, speed:int):void{
            	
    	//var target:ListBase = obj as ListBase;
    	var target:Object = obj;
    	
    	var pos:Number = target.horizontalScrollPosition + speed;
    	 if( pos <= 0 ){
    		target.horizontalScrollPosition = 0;
    	}else if( pos >= target.maxHorizontalScrollPosition){
    		target.horizontalScrollPosition = target.maxHorizontalScrollPosition;
    	}else{
    		target.horizontalScrollPosition = pos;
    	} 
    	
		target.validateNow();
    	 
    }

}
}